home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
byt87ibm.arc
/
SAGAN.ARC
/
MICROSOF.ASM
< prev
next >
Wrap
Assembly Source File
|
1987-06-03
|
3KB
|
102 lines
;
;
MSDOS EQU 21H ; Ms dos interrupt call
MSYSCALL EQU 51 ; Microsoft system call
;
;
; This is the main entry point
; all driver routines take the function call number in BX
;
; function 0 = initialize mouse
; function 1 = return button status
; function 2 = return relative motion
; function 3 = de-initialize mouse
; function 4 = return current serial port
;
; Normally this would be a far procedure but to avoid getting into
; all the intricasies of loading and calling drivers I've converted
; ENTRY to a near procedure and combined it with the sample program.
;
ENTRY PROC NEAR
CLD ; go in the forward direction
PUSH DS ; save callers segment
PUSH CS ; make this segment addressable
POP DS
SHL BX,1 ; point to routine
CALL ROUTINES[BX] ; and call it through table
POP DS ; restore users segment
RET ; return far to caller
ENTRY ENDP
;
DB 'Microsoft',00 ; name
MOUSEF DB 0
;
ROUTINES LABEL WORD
DW ISERIAL ; function 0 = initialize mouse
DW BUTTONSTAT ; function 1 = return button status
DW MOTIONCOUNT ; function 2 = return relative motion
DW DSERIAL ; function 3 = de-initialize mouse
DW GSERIAL ; function 4 = return current serial port
DW RETADR ; function 5 = reserved
DW RETADR ; function 6 = reserved
DW RETADR ; function 7 = reserved
;
;
BUTTONSTAT:
SUB AX,AX
TEST MOUSEF,0FFH ; if no mouse then return zero
JZ BSTAT2
MOV AX,5
SUB BX,BX
INT MSYSCALL ; Read button press info
SUB AH,AH ; make ax contain press info
BSTAT2:
;
; for Microsoft mouse the exit routine does nothing
;
DSERIAL:
RETADR:
RET
;
; This routine returns delta mouse movement
; Ax = delta x
; Bx = delta y
;
MOTIONCOUNT:
SUB AX,AX
MOV BX,AX
TEST MOUSEF,0FFH
JZ MCOUNT2
PUSH DX
PUSH CX
MOV AX,11
INT MSYSCALL
MOV AX,CX ; place into appropriate
MOV BX,DX ; registers
POP CX
POP DX
MCOUNT2:
RET
;
GSERIAL:
SUB AX,AX ; No serial port needed
RET ; for Microsoft Mouse
;
ISERIAL PROC NEAR
PUSH ES
PUSH BX
MOV AX,03500h+MSYSCALL ; 35h = get INTerrupt vector
INT MSDOS ; returns in ES:BX
MOV AX,ES
OR AX,BX ; Does interupt point at 0:0?
MOV AX,0 ; if it does then
POP BX ; Mouse software is not loaded
POP ES ; and therefore cannot be called
JZ SER2 ; to do initialization.
INT MSYSCALL
SER2:
MOV MOUSEF,AL
RET ; returns al non 0 if mouse exists.
ISERIAL ENDP
;